﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Sample
{
  /// <summary>
  /// Interaction logic for WinCarousel.xaml
  /// </summary>
  public partial class WinCarousel : Window
  {
    public WinCarousel()
    {
      InitializeComponent();
    }

    #region Carousel

    private void CarouselSpeedSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
    {
      ExampleCarouselControl.RotationSpeed = e.NewValue;
    }

    private void LookdownOffsetSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
    {
      ExampleCarouselControl.LookDownOffset = e.NewValue;
      ExampleCarouselControl.SetElementPositions();
    }

    private void CarouselFadeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
    {
      ExampleCarouselControl.Fade = e.NewValue;
      ExampleCarouselControl.SetElementPositions();
    }

    private void CarouselScaleSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
    {
      ExampleCarouselControl.Scale = e.NewValue;
      ExampleCarouselControl.SetElementPositions();
    }

    private void VerticalOrientationRadioButton_Checked(object sender, RoutedEventArgs e)
    {
      ExampleCarouselControl.Width = 0;
      ExampleCarouselControl.Height = 600;
      ExampleCarouselControl.ReInitialize();
    }

    private void HorizontalOrientationRadioButton_Checked(object sender, RoutedEventArgs e)
    {
      ExampleCarouselControl.Width = 600;
      ExampleCarouselControl.Height = 0;
      ExampleCarouselControl.ReInitialize();
    }

    public void ExampleCarouselControl_OnElementSelected(object sender)
    {
      SphereControl selected = ExampleCarouselControl.CurrentlySelected as SphereControl;
      if ((CurrentlySelectedNameTextBlock != null) && (CurrentlySelectedNameShadowTextBlock != null))
      {
        CurrentlySelectedNameTextBlock.Text = selected.Name;
        CurrentlySelectedNameShadowTextBlock.Text = selected.Name;
      }
    }
    #endregion

    private void Button_Click(object sender, RoutedEventArgs e)
    {
      Border brdGray = new Border();
      brdGray.CornerRadius = new CornerRadius(25);
      brdGray.Background = Brushes.DarkGray;
      brdGray.Height = 50;
      brdGray.Width = 50;

      ExampleCarouselControl.Children.Add(brdGray);
    }
  }
}
